﻿using System;
using System.ComponentModel;


namespace advadev.Windows.DragDrop.Demo
{

    /// <summary>
    /// Represents the main view model
    /// </summary>
    public class MainViewModel : INotifyPropertyChanged
    {

        /// <summary>for internal use</summary>
        static private MainViewModel _current = new MainViewModel();


        /// <summary>
        /// Initializes a new instance of the MainViewModel class
        /// </summary>
        private MainViewModel()
        {
            DragItem1 = new DemoModelItem();
            DragItem2 = new DemoModelItem();
            DragItem3 = new DemoModelItem();
            DragItem4 = new DemoModelItem();
            DropItem1 = new DemoModelItem();
            DropItem2 = new DemoModelItem();
            DropItem3 = new DemoModelItem();
            DropItem4 = new DemoModelItem();
            DropItem5 = new DemoModelItem();
            DropItem6 = new DemoModelItem();
        }


        /// <summary>
        /// Gets the current main view model
        /// </summary>
        static public MainViewModel Current
        {
            get
            {
                return _current;
            }
        }

        /// <summary>
        /// Gets the drag item 1
        /// </summary>
        public DemoModelItem DragItem1
        {
            get;
            private set;
        }

        /// <summary>
        /// Gets the drag item 2
        /// </summary>
        public DemoModelItem DragItem2
        {
            get;
            private set;
        }

        /// <summary>
        /// Gets the drag item 3
        /// </summary>
        public DemoModelItem DragItem3
        {
            get;
            private set;
        }

        /// <summary>
        /// Gets the drag item 4
        /// </summary>
        public DemoModelItem DragItem4
        {
            get;
            private set;
        }

        /// <summary>
        /// Gets the drop item 1
        /// </summary>
        public DemoModelItem DropItem1
        {
            get;
            private set;
        }

        /// <summary>
        /// Gets the drop item 2
        /// </summary>
        public DemoModelItem DropItem2
        {
            get;
            private set;
        }

        /// <summary>
        /// Gets the drop item 3
        /// </summary>
        public DemoModelItem DropItem3
        {
            get;
            private set;
        }

        /// <summary>
        /// Gets the drop item 4
        /// </summary>
        public DemoModelItem DropItem4
        {
            get;
            private set;
        }

        /// <summary>
        /// Gets the drop item 5
        /// </summary>
        public DemoModelItem DropItem5
        {
            get;
            private set;
        }

        /// <summary>
        /// Gets the drop item 6
        /// </summary>
        public DemoModelItem DropItem6
        {
            get;
            private set;
        }


        #region INotifyPropertyChanged implementation
        /// <summary>for internal use</summary>
        private event PropertyChangedEventHandler _propertyChanged;

        /// <summary>
        /// Handles the "property changed" event
        /// </summary>
        /// <param name="propertyName">
        /// Name of the changed property
        /// </param>
        protected void OnPropertyChanged(string propertyName)
        {
            if (_propertyChanged != null)
            {
                _propertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        /// <summary>
        /// Occurs when a property value changes
        /// </summary>
        public event PropertyChangedEventHandler PropertyChanged
        {
            add
            {
                _propertyChanged += value;
            }
            remove
            {
                _propertyChanged -= value;
            }
        }
        #endregion INotifyPropertyChanged implementation

    }

}
